home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / dskut / exehex.zip / README < prev   
Text File  |  1991-03-30  |  4KB  |  121 lines

  1.                 EXEHEX
  2.  
  3. This program is used to convert Microsoft .EXE files to Intel HEX files that
  4. are suitable for burning into EPROM.
  5.  
  6. You CANNOT simply take your favorite program such as Microsoft WORD, and expect
  7. the exehex program make it work in EPROM.  You must write the programs to be
  8. used with this utility carefully, and with the full intent of running them on
  9. an embedded 80x86 microprocessor system.
  10.  
  11. Some things that must be done to be successful:
  12.  
  13. 1) Write a simple jump vector program in MASM that will reside in EPROM at
  14.    address FFFF:0000.  This program should consist of something like this for
  15.    an 8086/8088:
  16.  
  17. PwrInit    segment para public 'Code'
  18.     Public    Power_Start
  19. Power_Start    proc    far
  20.     org    0
  21. ;    jmp    far ptr 0F000:0000H        ;MASM won't allow this, so...
  22.     db    0EAH                ;fake a far jump to EPROM start
  23.     dd    0F0000000H            ;(segment)(offset)
  24.  
  25. Power_Start    endp
  26. PwrInit    ends
  27.     end
  28.  
  29.  
  30.    Then after linking with Microsoft linker, you pass the file thru
  31.    exehex like this:
  32.  
  33.     exehex -SFFFF -O0000 powerini.exe powerini.hex
  34.  
  35.    This startup vector is setup to reside at FFFF:0000 in EPROM, and to jump
  36.    to the first location in EPROM where your program will begin.
  37.  
  38. 2) Write a short chunk of code that will reside at the first location in your
  39.    EPROM (in this case F000:0000).  This code will setup the segment registers,
  40.    stack, interrupt vectors, copy initialized data to ram, and then when done,
  41.    will branch to your application program.
  42.  
  43. EPROMST    segment para public 'Code'
  44.     Public    EPROM_Begin
  45. EPROM_Begin    proc    near
  46.     org    0
  47.     xor    ax,ax            ;this example assumes 64K of RAM
  48.     mov    ds,ax
  49.     mov    es,ax
  50.     mov    ss,ax
  51.     mov    sp,STACK_TOP
  52.  
  53.     xor    si,si            ;int vectors start at offset 0
  54.     mov    cx,256            ;number of possible interrupt vectors
  55.  
  56.     mov    ax,0000H        ;set all vectors to power restart
  57.     mov    dx,0FFFFH        ;they should really go to default handler.
  58. IV_Loop:
  59.     mov    [si],ax
  60.     add    si,2
  61.     mov    [si],dx
  62.     add    si,2
  63.     loop    IV_Loop
  64.     .
  65.     .
  66.     jmp    Your_Code_Begin
  67.  
  68. EPROM_Begin    endp
  69. EPROMST    ends
  70.     end
  71.  
  72.    Then link your code, and pass it thru exehex like this:
  73.  
  74.     exehex -SF000 -O0000 -N yourcode.exe yourcode.hex
  75.  
  76. 3) Cat your power start vector to your linked code:
  77.  
  78.     copy yourcode.hex + powerini.hex EPROM.HEX
  79.  
  80. 4) Burn EPROM.HEX using your favorite method of burning intel hex files, and
  81.    watch your project come to life.
  82.  
  83. 5) Be sure to include a file that defines the segment ordering with every
  84.    assembly language file in the program.  For example:
  85.  
  86.     .seg                ;say you want segments in order shown
  87. EPROMST    segment para public 'Code'
  88. EPROMST ends
  89.  
  90. Code    segment para public 'Code'
  91. Code    ends
  92.  
  93. PwrInit    segment para public 'Code'
  94. PwrInit    ends
  95.  
  96. 6) Be sure and present the Code segment files to the the linker in the same
  97.    order that you want them to appear in EPROM. (eg. it would be handy to
  98.    have your startup code appear first in the EPROM. ;-) )
  99.  
  100. 7) Initialized data segments must not appear in the assembled output.  If you
  101.    want to initialize data, you must put that data into the EPROM in the code
  102.    segment.  If you want to be able to change the value of the initialized
  103.    data, you must make your program copy the data into the proper location in
  104.    RAM, and use it there (eg, the data must have the same offset it had in
  105.    EPROM, but just be in the RAM segment).
  106.  
  107. I have examples of startup code for 80186/80188 processors too, If you really
  108. need them, something can be arranged.  Bear in mind that I do this embedded
  109. processor stuff as my sole means of support and livelyhood, not just for fun.
  110.  
  111. Good Luck, If you have any questions, comments, or bug reports, I can be
  112. reached by email at: chuck@eng.umd.edu or:
  113.  
  114.  
  115.         Chuck Harris
  116.  
  117.         C.F. Harris - Consulting
  118.         9308 Canterbury Riding
  119.         Laurel, Maryland 20723
  120.         (301)490-7443
  121.